/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "stdafx.h"
#include "视口物体绘制.h"




void f_绘制_场景辅助物体() {
	f_ob_render(S_框架::g_基准网格线, E_管线槽::e_颜色渲染);
}

void f_绘制_方向小组件() {
	
}

void f_绘制_3D视口渲染回调(S_摄像机* camera, S_3D视口属性& 层属性, uint64 视口标识符) {
	
	switch (层属性.m_渲染层ID) {
		case 0: {
			f_绘制_场景辅助物体();

			for (uint32 i = 0; i < 4; ++i) {
				if (层属性.m_渲染元素 & (1 << i)) {
					for (auto& e :f_global_渲染物体()) {
						if (e.second->m_显示) f_ob_render_s(e.second, E_管线槽::e_颜色渲染, i);
					}
				}
			}
			//for (auto& e :f_global_渲染物体()) {
			//	f_ob_render(e.second, E_管线槽::e_颜色渲染, 层属性.m_渲染元素);
			//}

			break;
		}
		case 1: {
			f_绘制_3D视口激活物体渲染(camera);
			break;
		}
		case 2: {
			auto& 手柄 = S_框架::g_视口操作手柄[视口标识符];
			for (auto& e : 手柄) {
				f_ob_render(e, E_管线槽::e_颜色渲染);
			}
			break;
		}
		default:
			break;
	}
}

void f_绘制_3D视口小组件渲染回调(S_摄像机* camera, S_3D视口属性& 层属性, uint64 视口标识符) {

	switch (层属性.m_渲染层ID) {
		case 0: {
			f_ob_render(S_框架::g_场景方向轴, E_管线槽::e_颜色渲染);
			break;
		}
	}
}

void f_绘制_3D视口激活物体渲染(S_摄像机* camera) {
	for (auto& e : S_框架::g_拾取物体) {
		f_ob_render(e, 1);
	}
}




